<%@ Control Language="C#" AutoEventWireup="true" CodeFile="FileUploader.ascx.cs" Inherits="admin_webparts_Common_FileUploader" %>
<%@ Import Namespace="NTTHAO.CommonWeb" %>
<div class="tip">
<form id="Form1" runat="server">
    <h1><%=LanguageUtility.GetLanguageText("UPLOAD", Session)%></h1>
    <table width="100%" cellspacing="0" cellpadding="3" border="0" style="margin-top: 10px;">
        <tr>
            <td width="1%" nowrap="nowrap"><%=LanguageUtility.GetLanguageText("SELECT_FILE", Session)%>:</td>
            <td><asp:FileUpload ID="fulFile" runat="server" /></td>
        </tr>
        <tr>
            <td  nowrap="nowrap">&nbsp;</td>
            <td><asp:Button ID="btnUpload" runat="server" OnClick="btnUpload_Click" Text="Upload" /></td>
        </tr>
        <tr>
            <td nowrap="nowrap"><%=LanguageUtility.GetLanguageText("UPLOADED_FILE", Session)%>:</td>
            <td><b><asp:HyperLink ID="lnkUploadedFile" Target="_blank" runat="server">&nbsp;</asp:HyperLink></b></td>
        </tr>
        <tr>
            <td nowrap="nowrap"><%=LanguageUtility.GetLanguageText("PATH", Session)%>:</td>
            <td><b><asp:Label ID="lblUploadedFilePath" runat="server" Text=""></asp:Label></b></td>
        </tr>
    </table>
</form>
</div>
<div class="tip">
    <h1><%=LanguageUtility.GetLanguageText("UPLOADED_FILE_LIST", Session)%></h1>
</div>
<table border="1" cellpadding="0" cellspacing="0" class="grid" id="tbGrid">
    <tr>
        <th>#</th>
        <th><%=LanguageUtility.GetLanguageText("FILE_NAME", Session)%></th>
        <th style="width: 80px"><%=LanguageUtility.GetLanguageText("FILE_EXT", Session)%></th>
        <th><%=LanguageUtility.GetLanguageText("PATH", Session)%></th>
        <th><%=LanguageUtility.GetLanguageText("IMAGE", Session)%></th>
        <th width="42px"><%=LanguageUtility.GetLanguageText("DELETE", Session)%></th>
    </tr>
    <% for (int i = 0; i < this._UploadedFilesList.Length; i++)
    {
           %>
    <tr class="<%=(i%2==1?"even":"odd") %>">
        <td align="center"><%=i + 1 %></td>
        <td><a target="_blank" href="<%= @"http://" + Request.Url.Authority + (Request.ApplicationPath == "/" ? "" : Request.ApplicationPath) + "/" + Constant.UPLOAD_FILE_PATH + _UploadedFilesList[i]%>"><%=_UploadedFilesList[i]%></a></td>
        <td align="center"><%=_UploadedFilesExtention[i] %></td>
        <td><%=(Request.ApplicationPath == "/" ? "" : Request.ApplicationPath) + "/" + Constant.UPLOAD_FILE_PATH + _UploadedFilesList[i]%></td>
        <td align="center"><%=(_IsImageFiles[i] ? ("<img width=\"50px\" src=\"../" + Constant.UPLOAD_FILE_PATH + _UploadedFilesList[i]) + "\" />" : "&nbsp;")%></td>
        <!--
        <td align="center"><%=(_IsImageFiles[i] ? ("<img width=\"50px\" src=\"ImageProvider.aspx?imgurl=" + Server.UrlEncode( "/" + Constant.UPLOAD_FILE_PATH + _UploadedFilesList[i]) + "\" />") : "&nbsp;")%></td>
        -->
        <td align="center">
            <ul class="icon" style="width: 28px;">
                <li><a title="<%=LanguageUtility.GetLanguageText("DELETE", Session)%>" href="?type=upload&action=delete&file=<%=Server.UrlEncode(_UploadedFilesList[i]) %>" class="icon deletebn"  onclick="return confirmDelete()">&nbsp</a></li>
            </ul>
        </td>
    </tr>
           <%
       } %>
</table>
<script type="text/javascript">
    function confirmDelete() {
        var msg = '<%=LanguageUtility.GetLanguageText("CONFIRM_DELETE", Session).Replace(Environment.NewLine, "<br />")%>';
        return confirm(msg.replace(/<br \/>/gi, "\r\n").replace(/<br\/>/gi, "\r\n"));
    }
</script>

